
/*
    Software License

    Copyright (C) 2021-05-24  Xoronos

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, version 3.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

/*
    Liabilities

    The software is provided "AS IS" without any warranty of any kind, either expressed,
    implied, or statutory, including, but not limited to, any warranty that the software
    will conform to specifications, any implied warranties of merchantability, fitness
    for a particular purpose, and freedom from infringement, and any warranty that the
    documentation will conform to the software, or any warranty that the software will
    be error free.

    In no event shall Xoronos be liable for any damages, including, but not limited to,
    direct, indirect, special or consequential damages, arising out of, resulting from,
    or in any way connected with this software, whether or not based upon warranty,
    contract, tort, or otherwise, whether or not injury was sustained by persons or
    property or otherwise, and whether or not loss was sustained from, or arose out of
    the results of, or use of, the software or services provided hereunder.

    To request the provided software under a different license you can contact us at
    support@xoronos.com
*/

#include "lexcheck.h"
#include "lexcheck_backend.h"

int lex_check_option_multiple_cummands( int command, int v[], char *all_args[]
 )
{

    int found, i;

    int function_with_rndstr[19] =
        { XMSP_MAKE_START_POINT, XMMK_MAKE_MONOVALENT_KEY, XPXCR_PERMUTE_XMATRIX_COMP_RANDOM, XMP_MAKE_POINT,
        XMSP_START_POINT,
        XMMK_MAKE_MONOMIAL_KEY,
        XMMK_MAKE_MONOMIAL_KEY,
        XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY, XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE,
        XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE,
        XMR_MAKE_RESPONSE, XMSS_MAKE_SIGNATURE_SYMMETRIC, XMSA_MAKE_SIGNATURE_ASYMMETRIC,
        XMRS_MAKE_RING_SIGNATURE,
        XMCS_MAKE_CERTIFICATE_SYMMETRIC, XMCA_MAKE_CERTIFICATE_ASYMMETRIC, XSS_SPLIT_SYMMETRIC,
        XEA_ENCRYPT_ASYMMETRIC,
        XES_ENCRYPT_SYMMETRIC
    };

    int function_with_trap[25] =
        { XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE, XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE,
        XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE, XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE,
        XMMK_MAKE_MONOVALENT_KEY,
        XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE, XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE,
        XEPK_EXCHANGE_POLYVALENT_KEY,
        XCMK_CHECK_MONOVALENT_KEY, XMSS_MAKE_SIGNATURE_SYMMETRIC,
        XMSA_MAKE_SIGNATURE_ASYMMETRIC, XMRS_MAKE_RING_SIGNATURE,
        XMCS_MAKE_CERTIFICATE_SYMMETRIC,
        XMCA_MAKE_CERTIFICATE_ASYMMETRIC, XCSS_CHECK_SIGNATURE_SYMMETRIC, XCSA_CHECK_SIGNATURE_ASYMMETRIC,
        XCCS_CHECK_CERTIFICATE_SYMMETRIC,
        XCCA_CHECK_CERTIFICATE_ASYMMETRIC, XCRS_CHECK_RING_SIGNATURE, XMH_MAKE_HASH, XCH_CHECK_HASH,
        XEA_ENCRYPT_ASYMMETRIC, XES_ENCRYPT_SYMMETRIC,
        XDA_DECIPHER_ASYMMETRIC, XDS_DECIPHER_SYMMETRIC
    };

    int function_with_crc[3] = { XSS_SPLIT_SYMMETRIC, XEA_ENCRYPT_ASYMMETRIC, XES_ENCRYPT_SYMMETRIC };

    int function_with_state_size[9] =
        { XMSS_MAKE_SIGNATURE_SYMMETRIC, XMSA_MAKE_SIGNATURE_ASYMMETRIC, XMRS_MAKE_RING_SIGNATURE,
        XMCS_MAKE_CERTIFICATE_SYMMETRIC, XSS_SPLIT_SYMMETRIC,
        XMCA_MAKE_CERTIFICATE_ASYMMETRIC, XMH_MAKE_HASH, XEA_ENCRYPT_ASYMMETRIC, XES_ENCRYPT_SYMMETRIC
    };

    int function_with_xmatrix[36] =
        { XMMK_MAKE_MONOVALENT_KEY, XCX_CHECK_XMATRIX, XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER,
        XMBK_MAKE_BINOMIAL_KEY, XMSP_MAKE_START_POINT,
        XEMK_EXCHANGE_MONOMIAL_KEY, XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC,
        XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL,
        XMMK_MAKE_MONOMIAL_KEY, XEPK_EXCHANGE_POLYVALENT_KEY, XCMK_CHECK_MONOVALENT_KEY,
        XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY,
        XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE, XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE, XMMP_MAKE_MONOMIAL_PROOF,
        XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE, XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE,
        XCMP_CHECK_MONOMIAL_PROOF,
        XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE, XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE,
        XMSS_MAKE_SIGNATURE_SYMMETRIC,
        XMSA_MAKE_SIGNATURE_ASYMMETRIC, XMRS_MAKE_RING_SIGNATURE, XMCS_MAKE_CERTIFICATE_SYMMETRIC,
        XMCA_MAKE_CERTIFICATE_ASYMMETRIC,
        XCSS_CHECK_SIGNATURE_SYMMETRIC, XCSA_CHECK_SIGNATURE_ASYMMETRIC, XCRS_CHECK_RING_SIGNATURE,
        XCCS_CHECK_CERTIFICATE_SYMMETRIC,
        XCCA_CHECK_CERTIFICATE_ASYMMETRIC, XMH_MAKE_HASH, XCH_CHECK_HASH, XEA_ENCRYPT_ASYMMETRIC,
        XES_ENCRYPT_SYMMETRIC,
        XDA_DECIPHER_ASYMMETRIC, XDS_DECIPHER_SYMMETRIC
    };

    int function_with_xmatrix_comp[5] =
        { XPXCR_PERMUTE_XMATRIX_COMP_RANDOM, XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC,
        XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL,
        XDX_DECOMPRESS_XMATRIX, XCXC_CHECK_XMATRIX_COMP
    };

    int function_with_arch[63] =
        { XCX_CHECK_XMATRIX, XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL, XMXCR_MINE_XMATRIX_COMP_RND,
        XMXCO_MINE_XMATRIX_COMP_OT,
        XPRS_PERMUTE_RING_SIGNATURE,
        XPXCR_PERMUTE_XMATRIX_COMP_RANDOM,
        XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC,
        XDX_DECOMPRESS_XMATRIX, XCXC_CHECK_XMATRIX_COMP, XCXC_CHECK_XMATRIX_COMP, XMP_MAKE_POINT,
        XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER,
        XMSP_MAKE_START_POINT, XMMK_MAKE_MONOMIAL_KEY, XMBK_MAKE_BINOMIAL_KEY, XEMK_EXCHANGE_MONOMIAL_KEY,
        XMMK_MAKE_MONOVALENT_KEY,
        XEPK_EXCHANGE_POLYVALENT_KEY, XCMK_CHECK_MONOVALENT_KEY, XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY,
        XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE,
        XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE, XMR_MAKE_RESPONSE, XMMP_MAKE_MONOMIAL_PROOF,
        XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE,
        XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE, XCMP_CHECK_MONOMIAL_PROOF,
        XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE,
        XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE, XMSS_MAKE_SIGNATURE_SYMMETRIC,
        XMSA_MAKE_SIGNATURE_ASYMMETRIC,
        XMRS_MAKE_RING_SIGNATURE, XMCS_MAKE_CERTIFICATE_SYMMETRIC, XMCA_MAKE_CERTIFICATE_ASYMMETRIC,
        XCSS_CHECK_SIGNATURE_SYMMETRIC, XCACTBK_CONVERT_ASYMMETRIC_CERTIFICATE_TO_BINOMIAL_KEY,
        XCSA_CHECK_SIGNATURE_ASYMMETRIC, XCRS_CHECK_RING_SIGNATURE, XCCS_CHECK_CERTIFICATE_SYMMETRIC,
        XCCA_CHECK_CERTIFICATE_ASYMMETRIC,
        XMH_MAKE_HASH, XCH_CHECK_HASH, XCHTP_CONVERT_HASH_TO_POINT, XCHTMK_CONVERT_HASH_TO_MONOMIAL_KEY,
        XCPTMK_CONVERT_POINT_TO_MONOMIAL_KEY,
        XCMKTP_CONVERT_MONOMIAL_KEY_TO_POINT, XCBKTSP_CONVERT_BINOMIAL_KEY_TO_START_POINT,
        XCSPTP_CONVERT_START_POINT_TO_POINT, XCPTSP_CONVERT_POINT_TO_START_POINT,
        XCMKTMC_CONVERT_MONOMIAL_KEY_TO_MONOMIAL_COMMITMENT,
        XCMCTMK_CONVERT_MONOMIAL_COMMITMENT_TO_MONOMIAL_KEY, XSS_SPLIT_SYMMETRIC, XEA_ENCRYPT_ASYMMETRIC,
        XES_ENCRYPT_SYMMETRIC, XCSCTMK_CONVERT_SYMMETRIC_CERTIFICATE_TO_MONOVALENT_KEY,
        XJS_JOIN_SYMMETRIC, XDA_DECIPHER_ASYMMETRIC, XDS_DECIPHER_SYMMETRIC, XPH_PRINT_HEADER,
        XCASTBK_CONVERT_ASYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY,
        XCSSTBK_CONVERT_SYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY,
        XCBKTAS_CONVERT_BINOMIAL_KEY_TO_ASYMMETRIC_SIGNATURE,
        XCBKTSS_CONVERT_BINOMIAL_KEY_TO_SYMMETRIC_SIGNATURE
    };

    int function_with_infolog[18] = {
        XCXC_CHECK_XMATRIX_COMP, XCX_CHECK_XMATRIX, XCMK_CHECK_MONOVALENT_KEY, XCMP_CHECK_MONOMIAL_PROOF,
        XCCS_CHECK_CERTIFICATE_SYMMETRIC, XCCA_CHECK_CERTIFICATE_ASYMMETRIC, XCRS_CHECK_RING_SIGNATURE,
        XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE, XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE,
        XGC_GET_CAPACITY,
        XCSS_CHECK_SIGNATURE_SYMMETRIC, XCSA_CHECK_SIGNATURE_ASYMMETRIC, XCRS_SIGNER_BINOMIAL_KEY,
        XCC_CHECK_CHECKSUM, XCH_CHECK_HASH, XCCB_CHECK_COMPLETE_BLOCK, XPH_PRINT_HEADER, XPLI_PRINT_LIB_INFO
    };

    if ( v[XLC_LIB_INFO_LOG] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_infolog ) / sizeof( function_with_infolog[0] ); i++ ) {
            if ( v[function_with_infolog[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XLC_LIB_INFO_LOG, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XAC_RND_STR] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_rndstr ) / sizeof( function_with_rndstr[0] ); i++ ) {
            if ( v[function_with_rndstr[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XAC_RND_STR, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XAC_NO_THREAD] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_trap ) / sizeof( function_with_trap[0] ); i++ ) {
            if ( v[function_with_trap[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XAC_NO_THREAD, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XAC_NO_CONST_EXEC_TIME] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_trap ) / sizeof( function_with_trap[0] ); i++ ) {
            if ( v[function_with_trap[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XAC_NO_CONST_EXEC_TIME, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XAC_CRC_BITS] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_crc ) / sizeof( function_with_crc[0] ); i++ ) {
            if ( v[function_with_crc[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XAC_CRC_BITS, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XAC_STATE_SIZE] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_state_size ) / sizeof( function_with_state_size[0] ); i++ ) {
            if ( v[function_with_state_size[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XAC_STATE_SIZE, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XSC_XMATRIX] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_xmatrix ) / sizeof( function_with_xmatrix[0] ); i++ ) {
            if ( v[function_with_xmatrix[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XSC_XMATRIX, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XSC_XMATRIX_COMP] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_xmatrix_comp ) / sizeof( function_with_xmatrix_comp[0] ); i++ ) {
            if ( v[function_with_xmatrix_comp[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XSC_XMATRIX_COMP, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XPC_ARCH] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_arch ) / sizeof( function_with_arch[0] ); i++ ) {
            if ( v[function_with_arch[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XPC_ARCH, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( v[XPC_SHARED_LIB] ) {

        found = 0;
        for ( i = 0; i < sizeof( function_with_arch ) / sizeof( function_with_arch[0] ); i++ ) {
            if ( v[function_with_arch[i]] ) {
                found = 1;
            }

        }

        if ( found == 0 ) {
            lex_print_redundant_option( XPC_SHARED_LIB, command, all_args );
            return XRNL_ERROR;
        }

    }

    return XRNL_SUCCESS;

}

int lex_convert_command_to_int( int current_command, char *argv, int *commandarg, char *all_args[]
 )
{

    int i;
    char buffer[50];

    strncpy( &buffer[2], argv, 47 );
    buffer[0] = '-';
    buffer[1] = '-';

    for ( i = 0; i < XLEN_ALL_ARGS; i++ ) {

        if ( !strncmp( buffer, all_args[i], 49 ) ) {
            if ( ( i != XN_NULL ) && ( i != XH_HELP ) && ( i != XS_SCRIPT ) && ( i != XE_EXAMPLE )
                 && ( i != XV_VERSION ) && ( i != XDC_DECODING_CONF ) && ( i != XEC_ENCODING_CONF )
                 && ( i != XSC_SEQUENCE_CONF ) && ( i != XAC_ARITHMETIC_CONF ) && ( i != XEC_ENCODING_CONF )
                 && ( i != XLC_LOGGING_CONF ) ) {
                *commandarg = i;
                return XRNL_SUCCESS;
            }

        }

    }

    return XRNL_ERROR;

}

int lex_check_multiple_cummands( int v[], char *all_args[], int *command
 )
{

    int i, sum, first_command, second_command, first_command_detected, second_command_detected,
        all_commands[] = XALL_COMM;

    sum = 0;
    first_command = 0;
    second_command = 0;
    first_command_detected = 0;
    second_command_detected = 0;

    for ( i = 0; i < XLEN_ALL_ARGS; i++ ) {
        if ( ( i != XMRS_ADD_DECOY_BINOMIAL_KEY ) && ( i != XCB_BLOCK_FILE ) ) {
            if ( v[i] >= 2 ) {

                snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                          "\nlexer error: argument %s repeted too many times\n", all_args[i] );
                XLEX_PRINT(  );
                return XRNL_ERROR;

            }

        }

    }

    for ( i = 0; i < XLEN_ALL_COMM; i++ ) {
        if ( ( all_commands[i] != XDC_DECODING_CONF ) &&
             ( all_commands[i] != XEC_ENCODING_CONF ) &&
             ( all_commands[i] != XAC_ARITHMETIC_CONF ) &&
             ( all_commands[i] != XSC_SEQUENCE_CONF ) &&
             ( all_commands[i] != XPC_PERMUTATION_CONF ) && ( all_commands[i] != XLC_LOGGING_CONF )
             ) {
            sum += v[all_commands[i]];

            if ( ( sum == 1 ) && ( first_command_detected == 0 ) ) {
                first_command = all_commands[i];
                first_command_detected = 1;
            }

            if ( ( sum == 2 ) && ( second_command_detected == 0 ) ) {
                second_command = all_commands[i];
                second_command_detected = 1;
            }

        }

    }

    if ( sum == 1 ) {
        *command = first_command;
        return XRNL_SUCCESS;

    } else if ( sum == 0 ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: no command specified\n" );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    } else {

        lex_print_uncompatible_message( first_command, second_command, all_args );
        return XRNL_ERROR;

    }

    return XRNL_SUCCESS;
}

int lex_check_decoding_conf( int v[], char *all_args[]
 )
{

    if ( !v[XDC_DECODING_CONF] ) {

        lex_print_mandatory_message( XDC_DECODING_CONF, all_args );
        return XRNL_ERROR;

    }

    // check if at least -no-param -compiled-param -encoding-param is asserted

    if ( ( !( v[XDC_COMPILED_PARAM] || v[XDC_ENCODING_PARAM] || v[XDC_NO_PARAM] ) )
         && ( v[XDC_DECODING_CONF] ) ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: either one of %s %s %s should be specified when %s\n",
                  all_args[XDC_COMPILED_PARAM], all_args[XDC_ENCODING_PARAM], all_args[XDC_NO_PARAM],
                  all_args[XDC_DECODING_CONF] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    // check no argument after no param

    if ( ( v[XDC_NO_PARAM] ) && ( ( v[XDC_INIT_FILE] || v[XDC_NO_PASSWORD] || v[XDC_PASSWORD_STR]
                                    || v[XDC_NO_RUNNING_ERR] || v[XDC_RUNNING_ERR_TH] || v[XDC_RUNNING_WAR_TH]
                                    || v[XDC_NO_DISPARITY_ERR] || v[XDC_DISPARITY_ERR_TH]
                                    || v[XDC_DISPARITY_WAR_TH] ) ) ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: no decoding configuration argument should follow %s\n",
                  all_args[XDC_NO_PARAM] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    // check if either -no-password -password-str

    if ( v[XDC_NO_PASSWORD] == 1 ) {

        if ( v[XDC_PASSWORD_STR] == 1 ) {

            lex_print_uncompatible_message( XDC_NO_PASSWORD, XDC_PASSWORD_STR, all_args );
            return XRNL_ERROR;

        }

    }

    if ( v[XDC_NO_PASSWORD] == 1 ) {

        if ( v[XDC_INIT_FILE] == 1 ) {

            lex_print_uncompatible_message( XDC_NO_PASSWORD, XDC_INIT_FILE, all_args );
            return XRNL_ERROR;

        }

    }

    if ( v[XDC_PASSWORD_STR] == 1 ) {

        if ( v[XDC_INIT_FILE] == 1 ) {

            lex_print_uncompatible_message( XDC_PASSWORD_STR, XDC_INIT_FILE, all_args );
            return XRNL_ERROR;

        }

    }

    // check if either -compiled-param -encoding-param -no-param are used

    if ( v[XDC_ENCODING_PARAM] == 1 ) {

        if ( v[XDC_COMPILED_PARAM] == 1 ) {

            lex_print_uncompatible_message( XDC_ENCODING_PARAM, XDC_COMPILED_PARAM, all_args );
            return XRNL_ERROR;

        }

        if ( v[XDC_NO_PARAM] == 1 ) {

            lex_print_uncompatible_message( XDC_ENCODING_PARAM, XDC_NO_PARAM, all_args );
            return XRNL_ERROR;

        }

    }

    if ( v[XDC_NO_PARAM] == 1 ) {

        if ( v[XDC_ENCODING_PARAM] == 1 ) {

            lex_print_uncompatible_message( XDC_NO_PARAM, XDC_ENCODING_PARAM, all_args );
            return XRNL_ERROR;

        }

        if ( v[XDC_COMPILED_PARAM] == 1 ) {

            lex_print_uncompatible_message( XDC_NO_PARAM, XDC_COMPILED_PARAM, all_args );
            return XRNL_ERROR;

        }

    }

    if ( v[XDC_ENCODING_PARAM] == 1 ) {

        if ( v[XDC_NO_PARAM] == 1 ) {

            lex_print_uncompatible_message( XDC_ENCODING_PARAM, XDC_NO_PARAM, all_args );
            return XRNL_ERROR;
        }

        if ( v[XDC_COMPILED_PARAM] == 1 ) {

            lex_print_uncompatible_message( XDC_ENCODING_PARAM, XDC_COMPILED_PARAM, all_args );
            return XRNL_ERROR;

        }

    }

    // check if either -no-running-err -no-disparity-err -running-err-th -running-war-th

    if ( v[XDC_NO_RUNNING_ERR] == 1 ) {

        if ( v[XDC_RUNNING_ERR_TH] == 1 ) {

            lex_print_uncompatible_message( XDC_NO_RUNNING_ERR, XDC_RUNNING_ERR_TH, all_args );
            return XRNL_ERROR;

        }

        if ( v[XDC_RUNNING_WAR_TH] == 1 ) {

            lex_print_uncompatible_message( XDC_NO_RUNNING_ERR, XDC_RUNNING_WAR_TH, all_args );
            return XRNL_ERROR;

        }

    }

    // check if -running-war-th and -running-err-th

    if ( v[XDC_RUNNING_WAR_TH] == 1 ) {

        if ( v[XDC_RUNNING_ERR_TH] != 1 ) {

            lex_print_relative_mandatory_message( XDC_RUNNING_WAR_TH, XDC_RUNNING_ERR_TH, all_args );
            return XRNL_ERROR;

        }

    }

    // check if either -no-disparity-err -no-disparity-war -disparity-err-th -disparity-war-th

    if ( v[XDC_NO_DISPARITY_ERR] == 1 ) {

        if ( v[XDC_DISPARITY_ERR_TH] == 1 ) {

            lex_print_uncompatible_message( XDC_NO_DISPARITY_ERR, XDC_DISPARITY_ERR_TH, all_args );
            return XRNL_ERROR;

        }

        if ( v[XDC_DISPARITY_WAR_TH] == 1 ) {

            lex_print_uncompatible_message( XDC_NO_DISPARITY_ERR, XDC_DISPARITY_WAR_TH, all_args );
            return XRNL_ERROR;

        }

    }

    // check if -disparity-war-th and -disparity-err-th

    if ( v[XDC_DISPARITY_WAR_TH] == 1 ) {

        if ( v[XDC_DISPARITY_ERR_TH] != 1 ) {

            lex_print_relative_mandatory_message( XDC_DISPARITY_WAR_TH, XDC_DISPARITY_ERR_TH, all_args );
            return XRNL_ERROR;

        }

    }

    return XRNL_SUCCESS;

}

int lex_check_encoding_conf( int v[], char *all_args[]
 )
{

    if ( !v[XEC_ENCODING_CONF] ) {

        lex_print_mandatory_message( XEC_ENCODING_CONF, all_args );
        return XRNL_ERROR;

    }

    // check if at least -no-param -compiled-param -encoding-param is asserted

    if ( ( !( v[XEC_COMPILED_PARAM] || v[XEC_ENCODING_PARAM] || v[XEC_NO_PARAM] ) )
         && ( v[XEC_ENCODING_CONF] ) ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: either one of %s %s %s should be specified when %s\n",
                  all_args[XEC_COMPILED_PARAM], all_args[XEC_ENCODING_PARAM], all_args[XEC_NO_PARAM],
                  all_args[XEC_ENCODING_CONF] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    // check no argument after no param

    if ( v[XEC_NO_PARAM] && ( ( v[XEC_INIT_FILE] || v[XEC_NO_PASSWORD] || v[XEC_PASSWORD_STR]
                                || v[XEC_NO_RUNNING_ERR] || v[XEC_RUNNING_ERR_TH] || v[XEC_RUNNING_WAR_TH]
                                || v[XEC_NO_DISPARITY_ERR] || v[XEC_DISPARITY_ERR_TH]
                                || v[XEC_DISPARITY_WAR_TH] ) ) ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: no encoding configuration argument should follow %s\n",
                  all_args[XEC_NO_PARAM] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    // check if either -no-password -password-str

    if ( v[XEC_NO_PASSWORD] == 1 ) {

        if ( v[XEC_PASSWORD_STR] == 1 ) {

            lex_print_uncompatible_message( XEC_NO_PASSWORD, XEC_PASSWORD_STR, all_args );
            return XRNL_ERROR;

        }

    }

    // check if either -compiled-param -encoding-param -no-param are used

    if ( v[XEC_COMPILED_PARAM] == 1 ) {

        if ( v[XEC_ENCODING_PARAM] == 1 ) {

            lex_print_uncompatible_message( XEC_COMPILED_PARAM, XEC_ENCODING_PARAM, all_args );
            return XRNL_ERROR;

            return XRNL_ERROR;

        }

        if ( v[XEC_NO_PARAM] == 1 ) {

            lex_print_uncompatible_message( XEC_COMPILED_PARAM, XEC_NO_PARAM, all_args );
            return XRNL_ERROR;

        }

    }

    if ( XEC_NO_PARAM == 1 ) {

        if ( XEC_ENCODING_PARAM == 1 ) {

            lex_print_uncompatible_message( XEC_NO_PARAM, XEC_ENCODING_PARAM, all_args );
            return XRNL_ERROR;

        }

        if ( v[XEC_COMPILED_PARAM] == 1 ) {

            lex_print_uncompatible_message( XEC_NO_PARAM, XEC_COMPILED_PARAM, all_args );
            return XRNL_ERROR;

        }

    }

    if ( v[XEC_NO_PASSWORD] == 1 ) {

        if ( v[XEC_INIT_FILE] == 1 ) {

            lex_print_uncompatible_message( XEC_NO_PASSWORD, XEC_INIT_FILE, all_args );
            return XRNL_ERROR;

        }

    }

    if ( v[XEC_PASSWORD_STR] == 1 ) {

        if ( v[XEC_INIT_FILE] == 1 ) {

            lex_print_uncompatible_message( XEC_PASSWORD_STR, XDC_INIT_FILE, all_args );
            return XRNL_ERROR;

        }

    }

    if ( v[XEC_ENCODING_PARAM] == 1 ) {

        if ( v[XEC_NO_PARAM] == 1 ) {

            lex_print_uncompatible_message( XEC_ENCODING_PARAM, XEC_NO_PARAM, all_args );
            return XRNL_ERROR;

        }

        if ( v[XEC_COMPILED_PARAM] == 1 ) {

            lex_print_uncompatible_message( XEC_ENCODING_PARAM, XEC_COMPILED_PARAM, all_args );
            return XRNL_ERROR;

        }

    }

    // check if either -no-running-err -no-disparity-err -running-err-th -running-war-th

    if ( v[XEC_NO_RUNNING_ERR] == 1 ) {

        if ( v[XEC_RUNNING_ERR_TH] == 1 ) {

            lex_print_uncompatible_message( XEC_NO_RUNNING_ERR, XEC_RUNNING_ERR_TH, all_args );
            return XRNL_ERROR;

        }

        if ( v[XEC_RUNNING_WAR_TH] == 1 ) {

            lex_print_uncompatible_message( XEC_NO_RUNNING_ERR, XEC_RUNNING_WAR_TH, all_args );
            return XRNL_ERROR;

        }

    }

    // check if -running-war-th and -running-err-th

    if ( v[XEC_RUNNING_WAR_TH] == 1 ) {

        if ( v[XEC_RUNNING_ERR_TH] != 1 ) {

            lex_print_relative_mandatory_message( XEC_RUNNING_WAR_TH, XEC_RUNNING_ERR_TH, all_args );
            return XRNL_ERROR;

        }

    }

    // check if either -no-disparity-err -no-disparity-war -disparity-err-th -disparity-war-th

    if ( v[XEC_NO_DISPARITY_ERR] == 1 ) {

        if ( v[XEC_DISPARITY_ERR_TH] == 1 ) {

            lex_print_uncompatible_message( XEC_NO_DISPARITY_ERR, XEC_DISPARITY_ERR_TH, all_args );
            return XRNL_ERROR;

        }

        if ( v[XEC_DISPARITY_WAR_TH] == 1 ) {

            lex_print_uncompatible_message( XEC_NO_DISPARITY_ERR, XEC_DISPARITY_WAR_TH, all_args );
            return XRNL_ERROR;

        }

    }

    // check if -disparity-war-th and -disparity-err-th

    if ( v[XEC_DISPARITY_WAR_TH] == 1 ) {

        if ( v[XEC_DISPARITY_ERR_TH] != 1 ) {

            lex_print_relative_mandatory_message( XEC_DISPARITY_WAR_TH, XEC_DISPARITY_ERR_TH, all_args );
            return XRNL_ERROR;

        }

    }

    return XRNL_SUCCESS;

}

int lex_check_logging_conf( int v[], char *all_args[]
 )
{

    if ( !v[XLC_LOGGING_CONF] ) {

        lex_print_mandatory_message( XLC_LOGGING_CONF, all_args );
        return XRNL_ERROR;

    }

    if ( ( !( v[XLC_LIB_ERROR_LOG] || v[XLC_LIB_WARNING_LOG] || v[XLC_LIB_INFO_LOG] || v[XLC_LIB_DEBUG_LOG] ||
              v[XLC_DEBUG_SEED] || v[XLC_COMMAND_LINE_LOG] || v[XLC_FORCE_APPEND] || v[XLC_FORCE_WRITE] ||
              v[XLC_NO_LIB_ERROR_LOG] || v[XLC_NO_LIB_WARNING_LOG] || v[XLC_NO_COMMAND_LINE_LOG] ) )
         && ( v[XLC_LOGGING_CONF] ) ) {

        snprintf
            ( lexer_log.buffer, BUFF_PRINT_SIZE,
              "\nlexer error: either one of %s %s %s %s %s %s %s %s %s %s %s should be specified when %s\n",
              all_args[XLC_DEBUG_SEED], all_args[XLC_COMMAND_LINE_LOG], all_args[XLC_LIB_ERROR_LOG],
              all_args[XLC_LIB_WARNING_LOG], all_args[XLC_LIB_INFO_LOG], all_args[XLC_LIB_DEBUG_LOG],
              all_args[XLC_NO_LIB_ERROR_LOG], all_args[XLC_NO_LIB_WARNING_LOG],
              all_args[XLC_NO_COMMAND_LINE_LOG], all_args[XLC_FORCE_APPEND], all_args[XLC_FORCE_WRITE],
              all_args[XLC_LOGGING_CONF] );
        XLEX_PRINT(  );

        return XRNL_ERROR;

    }

    if ( v[XLC_FORCE_APPEND] + v[XLC_FORCE_WRITE] >= 2 ) {
        lex_print_uncompatible_message( XLC_FORCE_APPEND, XLC_FORCE_WRITE, all_args );
        return XRNL_ERROR;
    }

    // check if help example or script command is asserted

    if ( ( v[XLC_LIB_ERROR_LOG] || v[XLC_LIB_WARNING_LOG] || v[XLC_LIB_INFO_LOG] || v[XLC_LIB_DEBUG_LOG]
           || v[XLC_DEBUG_SEED] || v[XLC_NO_LIB_ERROR_LOG] || v[XLC_NO_LIB_WARNING_LOG] )
         && ( v[XE_EXAMPLE] || v[XH_HELP] || v[XS_SCRIPT] ) ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: %s %s %s %s %s %s %s %s are redundant when %s %s are specified \n",
                  all_args[XLC_LIB_ERROR_LOG], all_args[XLC_LIB_WARNING_LOG], all_args[XLC_LIB_INFO_LOG],
                  all_args[XLC_LIB_DEBUG_LOG], all_args[XLC_DEBUG_SEED], all_args[XLC_NO_LIB_ERROR_LOG],
                  all_args[XLC_NO_LIB_WARNING_LOG],
                  all_args[XE_EXAMPLE], all_args[XS_SCRIPT], all_args[XH_HELP] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    // check either -no-lexer-log -lexer-log

    if ( v[XLC_NO_COMMAND_LINE_LOG] == 1 ) {

        if ( v[XLC_COMMAND_LINE_LOG] == 1 ) {

            lex_print_uncompatible_message( XLC_COMMAND_LINE_LOG, XLC_NO_COMMAND_LINE_LOG, all_args );
            return XRNL_ERROR;

        }

    }

    // check either -no-lib-error-log -error-log

    if ( v[XLC_NO_LIB_ERROR_LOG] == 1 ) {

        if ( v[XLC_LIB_ERROR_LOG] == 1 ) {

            lex_print_uncompatible_message( XLC_LIB_ERROR_LOG, XLC_NO_LIB_ERROR_LOG, all_args );
            return XRNL_ERROR;

        }

    }

    // check either -no-lib-warning-log -warning-log

    if ( v[XLC_NO_LIB_WARNING_LOG] == 1 ) {

        if ( v[XLC_LIB_WARNING_LOG] == 1 ) {

            lex_print_uncompatible_message( XLC_LIB_WARNING_LOG, XLC_NO_LIB_WARNING_LOG, all_args );
            return XRNL_ERROR;

        }

    }

    return XRNL_SUCCESS;

}

int lex_check_arithmetic_conf( int command, int option0, int option1, int option2, int option3, int v[],
                               char *all_args[]
 )
{

    int i;
    int option0_seen;
    int option1_seen;
    int option2_seen;
    int option3_seen;

    option0_seen = 0;
    option1_seen = 0;
    option2_seen = 0;
    option3_seen = 0;

    // mandatory --arithmetic-conf

    if ( v[XAC_ARITHMETIC_CONF] == 0 ) {

        lex_print_mandatory_message( XAC_ARITHMETIC_CONF, all_args );
        return XRNL_ERROR;

    }

    for ( i = XAC_ARITHMETIC_CONF + 1; i < XAC_STATE_SIZE; i++ ) {
        if ( ( v[i] == 1 )
             && ( ( i != option0 ) && ( i != option1 ) && ( i != option2 ) && ( i != option3 ) ) ) {

            lex_print_redundant_option( i, command, all_args );
            return XRNL_ERROR;

        }

        if ( i == option0 ) {
            option0_seen = 1;
        }

        if ( i == option1 ) {
            option1_seen = 1;
        }

        if ( i == option2 ) {
            option2_seen = 1;
        }

        if ( i == option3 ) {
            option3_seen = 1;
        }

    }

    if ( !( ( option0 == XAC_NO_THREAD ) || ( option0 == XAC_RND_STR )
            || ( option0 == XAC_NO_CONST_EXEC_TIME ) ) ) {
        if ( option0_seen == 0 ) {
            lex_print_relative_mandatory_message( option0, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( !( ( option1 == XAC_NO_THREAD ) || ( option1 == XAC_RND_STR )
            || ( option1 == XAC_NO_CONST_EXEC_TIME ) ) ) {
        if ( option1_seen == 0 ) {
            lex_print_relative_mandatory_message( option1, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( !( ( option2 == XAC_NO_THREAD ) || ( option2 == XAC_RND_STR )
            || ( option2 == XAC_NO_CONST_EXEC_TIME ) ) ) {
        if ( option2_seen == 0 ) {
            lex_print_relative_mandatory_message( option2, command, all_args );
            return XRNL_ERROR;
        }

    }

    if ( !( ( option3 == XAC_NO_THREAD ) || ( option3 == XAC_RND_STR )
            || ( option3 == XAC_NO_CONST_EXEC_TIME ) ) ) {
        if ( option3_seen == 0 ) {
            lex_print_relative_mandatory_message( option3, command, all_args );
            return XRNL_ERROR;
        }

    }

    return XRNL_SUCCESS;

}

int lex_check_sequence_conf( int command, int v[], char *all_args[]
 )
{

    // mandatory --sequence-conf

    if ( v[XSC_SEQUENCE_CONF] == 0 ) {

        lex_print_mandatory_message( XSC_SEQUENCE_CONF, all_args );
        return XRNL_ERROR;

    }

    // either -xmatrix-comp or -xmatrix should be specified

    if ( ( ( v[XSC_XMATRIX_COMP] || v[XSC_XMATRIX] ) == 0 )
         &&
         ( !( v[XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC] || v[XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL] ) ) )
    {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: either %s or %s needs to be specified when %s\n",
                  all_args[XSC_XMATRIX_COMP], all_args[XSC_XMATRIX], all_args[XSC_SEQUENCE_CONF] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_permutation_conf( int command, int v[], char *all_args[]
 )
{

    // mandatory --permutation-conf

    if ( v[XPC_PERMUTATION_CONF] == 0 ) {

        lex_print_mandatory_message( XPC_PERMUTATION_CONF, all_args );
        return XRNL_ERROR;

    }

    if ( ( !( v[XPC_SHARED_LIB] || v[XPC_ARCH] ) ) && ( v[XPC_PERMUTATION_CONF] ) ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: either %s and %s should be specified when %s\n", all_args[XPC_ARCH],
                  all_args[XPC_SHARED_LIB], all_args[XPC_PERMUTATION_CONF] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    if ( !( v[XPC_ARCH] || v[XPC_SHARED_LIB] ) ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: either %s or %s should be specified\n",
                  all_args[XPC_ARCH], all_args[XPC_SHARED_LIB] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    if ( ( v[XPC_ARCH] ) && ( v[XPC_SHARED_LIB] ) ) {

        lex_print_redundant_option( XPC_ARCH, XPC_SHARED_LIB, all_args );
        return XRNL_ERROR;

    }

    return XRNL_SUCCESS;

}

int lex_check_dump_encoding_param( int v[], char *all_args[]
 )
{

    // mandatory -encoding-param

    if ( v[XDEP_ENCODING_PARAM] == 0 ) {

        lex_print_relative_mandatory_message( XDEP_ENCODING_PARAM, XDEP_DUMP_ENCODING_PARAM, all_args );
        return XRNL_ERROR;

    }

    if ( ( v[XDEP_ENCODING_PARAM] == 1 ) && ( v[XEC_NO_PARAM] == 1 ) ) {

        lex_print_uncompatible_message( XDEP_ENCODING_PARAM, XEC_NO_PARAM, all_args );
        return XRNL_ERROR;

    }

    if ( ( v[XDEP_ENCODING_PARAM] == 1 ) && ( ( v[XEC_PASSWORD_STR] == 0 ) && ( v[XEC_INIT_FILE] == 0 ) ) ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: either %s or %s should be specified when %s\n", all_args[XEC_PASSWORD_STR],
                  all_args[XEC_INIT_FILE], all_args[XDEP_DUMP_ENCODING_PARAM] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    // check if -encoding-param is set when --dump-encoding-param

    if ( ( !( v[XEC_ENCODING_CONF] ) ) && ( v[XDEP_DUMP_ENCODING_PARAM] ) ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: %s should be specified when %s\n",
                  all_args[XEC_ENCODING_CONF], all_args[XDEP_DUMP_ENCODING_PARAM] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // no --decoding-conf should be specified

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XDEP_DUMP_ENCODING_PARAM, all_args );
        return XRNL_ERROR;
    }

    // no --arithmetic-conf should be specified

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XDEP_DUMP_ENCODING_PARAM, all_args );
        return XRNL_ERROR;
    }

    // no --sequence-conf should be specified

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XDEP_DUMP_ENCODING_PARAM, all_args );
        return XRNL_ERROR;
    }

    // no --permutation-conf should be specified

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XDEP_DUMP_ENCODING_PARAM, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_decode_encode( int v[], char *all_args[]
 )
{
    // mandatory -to-encode -to-decode

    if ( v[XDE_TO_ENCODE] == 0 ) {

        lex_print_relative_mandatory_message( XDE_TO_ENCODE, XDE_DECODE_ENCODE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XDE_TO_DECODE] == 0 ) {

        lex_print_relative_mandatory_message( XDE_TO_DECODE, XDE_DECODE_ENCODE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // no --arithmetic-conf should be specified

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XDEP_DUMP_ENCODING_PARAM, all_args );
        return XRNL_ERROR;
    }

    // no --sequence-conf should be specified

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XDEP_DUMP_ENCODING_PARAM, all_args );
        return XRNL_ERROR;
    }

    // no --permutation-conf should be specified

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XDEP_DUMP_ENCODING_PARAM, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_mine_xmatrix_comp_rand( int v[], char *all_args[]
 )
{
    // mandatory -matrix-comp

    if ( v[XMXCR_XMATRIX_COMP] == 0 ) {

        lex_print_relative_mandatory_message( XMXCR_XMATRIX_COMP, XMXCR_MINE_XMATRIX_COMP_RND, all_args );
        return XRNL_ERROR;

    }

    // either the -pseudo-random or -random option should be specified

    if ( ( v[XMXCR_RANDOM] || v[XMXCR_PSEUDO_RANDOM] ) == 0 ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: either %s or %s should be specified when %s\n", all_args[XMXCR_RANDOM],
                  all_args[XMXCR_PSEUDO_RANDOM], all_args[XMXCR_MINE_XMATRIX_COMP_RND] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMXCR_MINE_XMATRIX_COMP_RND, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // if -pseudo-random option is specified

    if ( v[XMXCR_PSEUDO_RANDOM] ) {

        // also --arithmetic-conf and -point options should be specified when -pseudo-random

        if ( XRNL_SUCCESS !=
             lex_check_arithmetic_conf( XMXCR_MINE_XMATRIX_COMP_RND, XAC_POINT, XAC_POINT, XAC_POINT,
                                        XAC_POINT, v, all_args ) ) {
            return XRNL_ERROR;
        }

        // also --decoding-conf should be specified when -pseudo-random

        if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

        // if -random option is specified

    } else {

        // --arithmetic-conf should not be specified while -random

        if ( v[XAC_ARITHMETIC_CONF] ) {
            lex_print_redundant_option( XAC_ARITHMETIC_CONF, XMXCR_RANDOM, all_args );
            return XRNL_ERROR;
        }

        // also --decoding-conf should not be specified while -random

        if ( v[XDC_DECODING_CONF] ) {
            lex_print_redundant_option( XDC_DECODING_CONF, XMXCR_RANDOM, all_args );
            return XRNL_ERROR;
        }

    }

    // no --sequence-conf should be specified

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMXCR_MINE_XMATRIX_COMP_RND, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_mine_xmatrix_comp_ot( int v[], char *all_args[]
 )
{
    // mandatory -matrix-comp

    if ( v[XMXCO_XMATRIX_COMP] == 0 ) {

        lex_print_relative_mandatory_message( XMXCO_XMATRIX_COMP, XMXCO_MINE_XMATRIX_COMP_OT, all_args );
        return XRNL_ERROR;

    }

    // either the -pseudo-random or -random option should be specified

    if ( ( v[XMXCO_RANDOM] || v[XMXCO_PSEUDO_RANDOM] ) == 0 ) {

        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE,
                  "\nlexer error: either %s or %s should be specified when %s\n", all_args[XMXCO_RANDOM],
                  all_args[XMXCO_PSEUDO_RANDOM], all_args[XMXCO_MINE_XMATRIX_COMP_OT] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMXCO_MINE_XMATRIX_COMP_OT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // if -pseudo-random option is specified

    if ( v[XMXCO_PSEUDO_RANDOM] ) {

        // also --arithmetic-conf and -point options should be specified when -pseudo-random

        if ( XRNL_SUCCESS !=
             lex_check_arithmetic_conf( XMXCO_MINE_XMATRIX_COMP_OT, XAC_POINT, XAC_POINT, XAC_POINT,
                                        XAC_POINT, v, all_args ) ) {
            return XRNL_ERROR;
        }

        // also --decoding-conf should be specified when -pseudo-random

        if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

        // if -random option is specified

    } else {

        // --arithmetic-conf should not be specified while -random

        if ( v[XAC_ARITHMETIC_CONF] ) {
            lex_print_redundant_option( XAC_ARITHMETIC_CONF, XMXCO_RANDOM, all_args );
            return XRNL_ERROR;
        }

        // also --decoding-conf should not be specified while -random

        if ( v[XDC_DECODING_CONF] ) {
            lex_print_redundant_option( XDC_DECODING_CONF, XMXCO_RANDOM, all_args );
            return XRNL_ERROR;
        }

    }

    // no --sequence-conf should be specified

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMXCR_MINE_XMATRIX_COMP_RND, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_permute_xmatrix_comp_random( int v[], char *all_args[]
 )
{
    // mandatory -xmatrix-comp

    if ( v[XPXCR_XMATRIX_COMP_DST] == 0 ) {

        lex_print_relative_mandatory_message( XPXCR_XMATRIX_COMP_DST, XPXCR_PERMUTE_XMATRIX_COMP_RANDOM,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XSC_XMATRIX_COMP] == 0 ) {

        lex_print_relative_mandatory_message( XSC_XMATRIX_COMP, XPXCR_PERMUTE_XMATRIX_COMP_RANDOM, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // no --arithmetic-conf should be specified

    if ( v[XAC_RND_STR] ) {
        if ( XRNL_SUCCESS !=
             lex_check_arithmetic_conf( XPXCR_PERMUTE_XMATRIX_COMP_RANDOM, XAC_RND_STR, XAC_RND_STR,
                                        XAC_RND_STR, XAC_RND_STR, v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( v[XAC_ARITHMETIC_CONF] ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: the only allowed option for %s is %s\n",
                  all_args[XAC_ARITHMETIC_CONF], all_args[XAC_RND_STR] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    // --sequence-conf should be specified

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XPXCR_PERMUTE_XMATRIX_COMP_RANDOM, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // -xmatrix should not be specified

    if ( v[XSC_XMATRIX] ) {
        lex_print_redundant_option( XSC_XMATRIX, XPXCR_PERMUTE_XMATRIX_COMP_RANDOM, all_args );
        return XRNL_ERROR;
    }

    // --permutation-conf should be specified

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XPXCR_PERMUTE_XMATRIX_COMP_RANDOM, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_permute_xmatrix_comp_deterministic( int v[], char *all_args[]
 )
{
    // mandatory -xmatrix-comp
    if ( v[XPXCD_XMATRIX_COMP_DST] == 0 ) {

        lex_print_relative_mandatory_message( XPXCD_XMATRIX_COMP_DST,
                                              XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XSC_XMATRIX_COMP] == 0 ) {

        lex_print_relative_mandatory_message( XSC_XMATRIX_COMP, XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XSC_XMATRIX] == 0 ) {

        lex_print_relative_mandatory_message( XSC_XMATRIX, XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // no --arithmetic-conf should be specified

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC, all_args );
        return XRNL_ERROR;
    }

    // --sequence-conf should be specified

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // --permutation-conf should be specified

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_permute_xmatrix_comp_confidential( int v[], char *all_args[]
 )
{
    // mandatory -xmatrix-comp

    if ( v[XPXCS_XMATRIX_COMP_DST] == 0 ) {

        lex_print_relative_mandatory_message( XPXCS_XMATRIX_COMP_DST, XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XSC_XMATRIX_COMP] == 0 ) {

        lex_print_relative_mandatory_message( XSC_XMATRIX_COMP, XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XSC_XMATRIX] == 0 ) {

        lex_print_relative_mandatory_message( XSC_XMATRIX, XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // --arithmetic-conf should be specified

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // --sequence-conf should be specified

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // --permutation-conf should be specified

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_decompress_xmatrix( int v[], char *all_args[]
 )
{
    // mandatory -xmatrix-comp

    if ( v[XDX_XMATRIX] == 0 ) {

        lex_print_relative_mandatory_message( XDX_XMATRIX, XDX_DECOMPRESS_XMATRIX, all_args );
        return XRNL_ERROR;

    }

    if ( v[XSC_XMATRIX_COMP] == 0 ) {

        lex_print_relative_mandatory_message( XSC_XMATRIX_COMP, XDX_DECOMPRESS_XMATRIX, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // no --arithmetic-conf should be specified

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XDX_DECOMPRESS_XMATRIX, all_args );
        return XRNL_ERROR;
    }

    // --sequence-conf should be specified

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XDX_DECOMPRESS_XMATRIX, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // -xmatrix should not be specified

    if ( v[XSC_XMATRIX] ) {
        lex_print_redundant_option( XSC_XMATRIX, XDX_DECOMPRESS_XMATRIX, all_args );
        return XRNL_ERROR;
    }

    // --permutation-conf should be specified

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XDX_DECOMPRESS_XMATRIX, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_xmatrix_comp( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XSC_XMATRIX_COMP] == 0 ) {

        lex_print_relative_mandatory_message( XSC_XMATRIX_COMP, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // no --arithmetic-conf should be specified

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;
    }

    // --sequence-conf should be specified

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCXC_CHECK_XMATRIX_COMP, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // -xmatrix should not be specified

    if ( v[XSC_XMATRIX] ) {
        lex_print_redundant_option( XSC_XMATRIX, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;
    }

    // --permutation-conf should be specified

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCXC_CHECK_XMATRIX_COMP, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_xmatrix( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XSC_XMATRIX] == 0 ) {

        lex_print_relative_mandatory_message( XSC_XMATRIX, XCX_CHECK_XMATRIX, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // no --arithmetic-conf should be specified

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XCX_CHECK_XMATRIX, all_args );
        return XRNL_ERROR;
    }

    // --sequence-conf should be specified

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCX_CHECK_XMATRIX, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // -xmatrix-comp should not be specified

    if ( v[XSC_XMATRIX_COMP] ) {
        lex_print_redundant_option( XSC_XMATRIX, XCX_CHECK_XMATRIX, all_args );
        return XRNL_ERROR;
    }

    // --permutation-conf should be specified

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCX_CHECK_XMATRIX, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_point( int v[], char *all_args[]
 )
{
    // mandatory -point

    if ( v[XMP_POINT] == 0 ) {

        lex_print_relative_mandatory_message( XMP_POINT, XMP_MAKE_POINT, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    // no --decoding-conf should be specified

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XMP_MAKE_POINT, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XAC_RND_STR] ) {
        if ( XRNL_SUCCESS !=
             lex_check_arithmetic_conf( XMP_MAKE_POINT, XAC_RND_STR, XAC_RND_STR,
                                        XAC_RND_STR, XAC_RND_STR, v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( v[XAC_ARITHMETIC_CONF] ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: the only allowed option for %s is %s\n",
                  all_args[XAC_ARITHMETIC_CONF], all_args[XAC_RND_STR] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    // no --sequence-conf should be specified

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMP_MAKE_POINT, all_args );
        return XRNL_ERROR;
    }

    // --permutation-conf should be specified

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMP_MAKE_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_confidential_pseudo_random_number( int v[], char *all_args[]
 )
{
    // mandatory -next-point

    if ( v[XMSPRN_NEXT_POINT] == 0 ) {
        lex_print_relative_mandatory_message( XMSPRN_NEXT_POINT,
                                              XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER, all_args );
        return XRNL_ERROR;

    }

    if ( v[XAC_POINT] == 0 ) {

        lex_print_relative_mandatory_message( XAC_POINT, XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XAC_MONOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XAC_MONOMIAL_KEY, XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // --arithmetic-conf should be specified

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER, XAC_POINT,
                                    XAC_MONOMIAL_KEY, XAC_POINT, XAC_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    // --sequence-conf should be specified

    if ( XRNL_SUCCESS !=
         lex_check_sequence_conf( XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_XMATRIX] == 0 ) {
        lex_print_relative_mandatory_message( XSC_XMATRIX, XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER,
                                              all_args );
        return XRNL_ERROR;
    }

    // --permutation-conf should be specified

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_start_point( int v[], char *all_args[]
 )
{
    // mandatory -start-point

    if ( v[XMSP_START_POINT] == 0 ) {

        lex_print_relative_mandatory_message( XMSP_START_POINT, XMSP_MAKE_START_POINT, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XAC_RND_STR] ) {
        if ( XRNL_SUCCESS !=
             lex_check_arithmetic_conf( XMSP_MAKE_START_POINT, XAC_RND_STR, XAC_RND_STR,
                                        XAC_RND_STR, XAC_RND_STR, v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( v[XAC_ARITHMETIC_CONF] ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: the only allowed option for %s is %s\n",
                  all_args[XAC_ARITHMETIC_CONF], all_args[XAC_RND_STR] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMSP_MAKE_START_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMSP_MAKE_START_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_monomial_key( int v[], char *all_args[]
 )
{
    // mandatory -start-point

    if ( v[XMMK_MONOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XMMK_MONOMIAL_KEY, XMMK_MAKE_MONOMIAL_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XMMK_MAKE_MONOMIAL_KEY, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XAC_RND_STR] ) {
        if ( XRNL_SUCCESS !=
             lex_check_arithmetic_conf( XMMK_MAKE_MONOMIAL_KEY, XAC_RND_STR, XAC_RND_STR,
                                        XAC_RND_STR, XAC_RND_STR, v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( v[XAC_ARITHMETIC_CONF] ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: the only allowed option for %s is %s\n",
                  all_args[XAC_ARITHMETIC_CONF], all_args[XAC_RND_STR] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMMK_MAKE_MONOMIAL_KEY, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMMK_MAKE_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_binomial_key( int v[], char *all_args[]
 )
{
    // mandatory -start-point

    if ( v[XMBK_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XMBK_BINOMIAL_KEY, XMBK_MAKE_BINOMIAL_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMBK_MAKE_BINOMIAL_KEY, XAC_MONOMIAL_KEY, XAC_START_POINT,
                                    XAC_START_POINT, XAC_START_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMBK_MAKE_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMBK_MAKE_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_exchange_monomial_key( int v[], char *all_args[]
 )
{

    if ( v[XEMK_EXTERNAL_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XEMK_EXTERNAL_BINOMIAL_KEY, XEMK_EXCHANGE_MONOMIAL_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XEMK_SHARED_MONOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XEMK_SHARED_MONOMIAL_KEY, XEMK_EXCHANGE_MONOMIAL_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XEMK_EXCHANGE_MONOMIAL_KEY, XAC_MONOMIAL_KEY, XAC_BINOMIAL_KEY,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XEMK_EXCHANGE_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XEMK_EXCHANGE_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_monovalent_key( int v[], char *all_args[]
 )
{

    if ( v[XMMK_MONOVALENT_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XMMK_MONOVALENT_KEY, XMMK_MAKE_MONOVALENT_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMMK_POLYVALENT_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XMMK_POLYVALENT_KEY, XMMK_MAKE_MONOVALENT_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMMK_POLYVALENT_PROOF] == 0 ) {

        lex_print_relative_mandatory_message( XMMK_POLYVALENT_PROOF, XMMK_MAKE_MONOVALENT_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMMK_START_TIMESTAMP] == 0 ) {

        lex_print_relative_mandatory_message( XMMK_START_TIMESTAMP, XMMK_MAKE_MONOVALENT_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMMK_END_TIMESTAMP] == 0 ) {

        lex_print_relative_mandatory_message( XMMK_END_TIMESTAMP, XMMK_MAKE_MONOVALENT_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XAC_RND_STR] || v[XAC_NO_THREAD] || v[XAC_NO_CONST_EXEC_TIME] ) {
        if ( XRNL_SUCCESS !=
             lex_check_arithmetic_conf( XMMK_MAKE_MONOVALENT_KEY, XAC_RND_STR, XAC_RND_STR,
                                        XAC_NO_THREAD, XAC_NO_CONST_EXEC_TIME, v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( v[XAC_ARITHMETIC_CONF] ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: the only allowed option for %s is %s\n",
                  all_args[XAC_ARITHMETIC_CONF], all_args[XAC_RND_STR] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XEMK_EXCHANGE_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XEMK_EXCHANGE_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_exchange_polyvalent_key( int v[], char *all_args[]
 )
{

    if ( v[XEPK_EXTERNAL_MONOVALENT_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XEPK_EXTERNAL_MONOVALENT_KEY, XEPK_EXCHANGE_POLYVALENT_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XEPK_SHARED_POLYVALENT_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XEPK_SHARED_POLYVALENT_KEY, XEPK_EXCHANGE_POLYVALENT_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XEPK_EXCHANGE_POLYVALENT_KEY, XAC_MONOVALENT_KEY, XAC_POLYVALENT_KEY,
                                    XAC_POLYVALENT_PROOF, XAC_POLYVALENT_PROOF, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XEMK_EXCHANGE_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XEMK_EXCHANGE_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_monovalent_key( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XCMK_CHECK_MONOVALENT_KEY, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCMK_CHECK_MONOVALENT_KEY, XAC_POLYVALENT_PROOF, XAC_MONOVALENT_KEY,
                                    XAC_NO_THREAD, XAC_NO_CONST_EXEC_TIME, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCMK_CHECK_MONOVALENT_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCMK_CHECK_MONOVALENT_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_commitment_binomial_key( int v[], char *all_args[]
 )
{

    if ( v[XMCBK_MONOMIAL_COMMITMENT] == 0 ) {

        lex_print_relative_mandatory_message( XMCBK_MONOMIAL_COMMITMENT, XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCBK_BINOMIAL_COMMITMENT] == 0 ) {

        lex_print_relative_mandatory_message( XMCBK_BINOMIAL_COMMITMENT, XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY, XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMBK_MAKE_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMBK_MAKE_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_commitment_sym_signature( int v[], char *all_args[]
 )
{

    if ( v[XMCSS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMCSS_PLAIN_TEXT, XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCSS_BINOMIAL_COMMITMENT] == 0 ) {

        lex_print_relative_mandatory_message( XMCSS_BINOMIAL_COMMITMENT, XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCSS_MONOMIAL_COMMITMENT] == 0 ) {

        lex_print_relative_mandatory_message( XMCSS_MONOMIAL_COMMITMENT, XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE, XAC_SYM_SIGNATURE, XAC_SYM_SIGNATURE,
                                    XAC_SYM_SIGNATURE, XAC_SYM_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_commitment_sym_certificate( int v[], char *all_args[]
 )
{

    if ( v[XMCSC_BINOMIAL_COMMITMENT] == 0 ) {

        lex_print_relative_mandatory_message( XMCSC_BINOMIAL_COMMITMENT,
                                              XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCSC_MONOMIAL_COMMITMENT] == 0 ) {

        lex_print_relative_mandatory_message( XMCSC_MONOMIAL_COMMITMENT,
                                              XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE, XAC_SYM_CERTIFICATE,
                                    XAC_SYM_CERTIFICATE, XAC_SYM_CERTIFICATE, XAC_SYM_CERTIFICATE, v,
                                    all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_response( int v[], char *all_args[]
 )
{

    if ( v[XMR_MONOMIAL_RESPONSE] == 0 ) {

        lex_print_relative_mandatory_message( XMR_MONOMIAL_RESPONSE, XMR_MAKE_RESPONSE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XMR_MAKE_RESPONSE, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XAC_RND_STR] ) {
        if ( XRNL_SUCCESS !=
             lex_check_arithmetic_conf( XMR_MAKE_RESPONSE, XAC_RND_STR, XAC_RND_STR,
                                        XAC_RND_STR, XAC_RND_STR, v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( v[XAC_ARITHMETIC_CONF] ) {
        snprintf( lexer_log.buffer, BUFF_PRINT_SIZE, "\nlexer error: the only allowed option for %s is %s\n",
                  all_args[XAC_ARITHMETIC_CONF], all_args[XAC_RND_STR] );
        XLEX_PRINT(  );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMR_MAKE_RESPONSE, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMR_MAKE_RESPONSE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_monomial_proof( int v[], char *all_args[]
 )
{

    if ( v[XMMP_MONOMIAL_PROOF] == 0 ) {

        lex_print_relative_mandatory_message( XMMP_MONOMIAL_PROOF, XMMP_MAKE_MONOMIAL_PROOF, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMMP_MAKE_MONOMIAL_PROOF, XAC_BINOMIAL_KEY, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_COMMITMENT, XAC_MONOMIAL_RESPONSE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMMP_MAKE_MONOMIAL_PROOF, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMMP_MAKE_MONOMIAL_PROOF, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_monomial_proof_sym_signature( int v[], char *all_args[]
 )
{

    if ( v[XMMPSS_MONOMIAL_PROOF] == 0 ) {

        lex_print_relative_mandatory_message( XMMPSS_MONOMIAL_PROOF, XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMMPSS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMMPSS_PLAIN_TEXT, XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE, XAC_SYM_SIGNATURE,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_COMMITMENT, XAC_MONOMIAL_RESPONSE, v,
                                    all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_monomial_proof_sym_certificate( int v[], char *all_args[]
 )
{

    if ( v[XMMPSC_MONOMIAL_PROOF] == 0 ) {

        lex_print_relative_mandatory_message( XMMPSC_MONOMIAL_PROOF,
                                              XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE, XAC_SYM_CERTIFICATE,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_COMMITMENT, XAC_MONOMIAL_RESPONSE, v,
                                    all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_monomial_proof( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XCMP_CHECK_MONOMIAL_PROOF, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCMP_CHECK_MONOMIAL_PROOF, XAC_BINOMIAL_COMMITMENT, XAC_MONOMIAL_RESPONSE,
                                    XAC_MONOMIAL_PROOF, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCMP_CHECK_MONOMIAL_PROOF, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCMP_CHECK_MONOMIAL_PROOF, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_monomial_proof_sym_signature( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCMPSS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XCMPSS_PLAIN_TEXT, XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE, XAC_BINOMIAL_COMMITMENT,
                                    XAC_MONOMIAL_RESPONSE, XAC_MONOMIAL_PROOF, XAC_SYM_SIGNATURE, v,
                                    all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_monomial_proof_sym_certificate( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE, XAC_BINOMIAL_COMMITMENT,
                                    XAC_MONOMIAL_RESPONSE, XAC_MONOMIAL_PROOF, XAC_SYM_CERTIFICATE, v,
                                    all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_signature_symmetric( int v[], char *all_args[]
 )
{
    if ( v[XMSS_SYMMETRIC_SIGNATURE] == 0 ) {

        lex_print_relative_mandatory_message( XMSS_SYMMETRIC_SIGNATURE, XMSS_MAKE_SIGNATURE_SYMMETRIC,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMSS_PLAIN_TEXT, XMSS_MAKE_SIGNATURE_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMSS_MAKE_SIGNATURE_SYMMETRIC, XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMSS_MAKE_SIGNATURE_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMSS_MAKE_SIGNATURE_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_signature_asymmetric( int v[], char *all_args[]
 )
{
    if ( v[XMSA_ASYMMETRIC_SIGNATURE] == 0 ) {

        lex_print_relative_mandatory_message( XMSA_ASYMMETRIC_SIGNATURE, XMSA_MAKE_SIGNATURE_ASYMMETRIC,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSA_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMSA_PLAIN_TEXT, XMSA_MAKE_SIGNATURE_ASYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMSA_MAKE_SIGNATURE_ASYMMETRIC, XAC_MONOMIAL_KEY, XAC_BINOMIAL_KEY,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMSA_MAKE_SIGNATURE_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMSA_MAKE_SIGNATURE_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_permute_ring_signature( int v[], char *all_args[]
 )
{

    if ( v[XPRS_SIGNER_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XPRS_SIGNER_BINOMIAL_KEY, XPRS_PERMUTE_RING_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XPRS_VERIFIER_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XPRS_VERIFIER_BINOMIAL_KEY, XPRS_PERMUTE_RING_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XPRS_SIGNER_RING_SIGNATURE] == 0 ) {

        lex_print_relative_mandatory_message( XPRS_SIGNER_RING_SIGNATURE, XPRS_PERMUTE_RING_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XPRS_VERIFIER_RING_SIGNATURE] == 0 ) {

        lex_print_relative_mandatory_message( XPRS_VERIFIER_RING_SIGNATURE, XPRS_PERMUTE_RING_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XPRS_PERMUTED_RING_SIGNATURE] == 0 ) {

        lex_print_relative_mandatory_message( XPRS_PERMUTED_RING_SIGNATURE, XPRS_PERMUTE_RING_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XPRS_PERMUTE_RING_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_ring_signature( int v[], char *all_args[]
 )
{

    // defined in XRN_MIN_RING_SIG_SIZE XRN_MAX_RING_SIG_SIZE
    if ( ( ( v[XMRS_ADD_DECOY_BINOMIAL_KEY] + 2 ) > 255 ) || ( ( v[XMRS_ADD_DECOY_BINOMIAL_KEY] + 2 ) < 3 ) ) {

        snprintf
            ( lexer_log.buffer, BUFF_PRINT_SIZE,
              "\nlexer error: the number of %s options needs to be between 253 and 6, number of decoys detected %d\n",
              all_args[XMRS_ADD_DECOY_BINOMIAL_KEY], v[XMRS_ADD_DECOY_BINOMIAL_KEY] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    if ( v[XMRS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMRS_PLAIN_TEXT, XMRS_MAKE_RING_SIGNATURE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMRS_RING_SIGNATURE] == 0 ) {

        lex_print_relative_mandatory_message( XMRS_RING_SIGNATURE, XMRS_MAKE_RING_SIGNATURE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMRS_VERIFIER_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XMRS_VERIFIER_BINOMIAL_KEY, XMRS_MAKE_RING_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMRS_MAKE_RING_SIGNATURE, XAC_MONOMIAL_KEY, XAC_BINOMIAL_KEY,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMRS_MAKE_RING_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMRS_MAKE_RING_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_certificate_symmetric( int v[], char *all_args[]
 )
{
    if ( v[XMCS_SUBJECT_MONOVALENT_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XMCS_SYMMETRIC_CERTIFICATE, XMCS_MAKE_CERTIFICATE_SYMMETRIC,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCS_SYMMETRIC_CERTIFICATE] == 0 ) {

        lex_print_relative_mandatory_message( XMCS_SYMMETRIC_CERTIFICATE, XMCS_MAKE_CERTIFICATE_SYMMETRIC,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCS_START_TIMESTAMP] == 0 ) {

        lex_print_relative_mandatory_message( XMCS_START_TIMESTAMP, XMCS_MAKE_CERTIFICATE_SYMMETRIC,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCS_END_TIMESTAMP] == 0 ) {

        lex_print_relative_mandatory_message( XMCS_END_TIMESTAMP, XMCS_MAKE_CERTIFICATE_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XMCS_SUBJECT_STR] == 0 ) {

        lex_print_relative_mandatory_message( XMCS_END_TIMESTAMP, XMCS_MAKE_CERTIFICATE_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMCS_MAKE_CERTIFICATE_SYMMETRIC, XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMCS_MAKE_CERTIFICATE_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMCS_MAKE_CERTIFICATE_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_certificate_asymmetric( int v[], char *all_args[]
 )
{
    if ( v[XMCA_SUBJECT_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XMCA_ASYMMETRIC_CERTIFICATE, XMCA_ASYMMETRIC_CERTIFICATE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCA_ASYMMETRIC_CERTIFICATE] == 0 ) {

        lex_print_relative_mandatory_message( XMCA_ASYMMETRIC_CERTIFICATE, XMCA_ASYMMETRIC_CERTIFICATE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCA_START_TIMESTAMP] == 0 ) {

        lex_print_relative_mandatory_message( XMCA_START_TIMESTAMP, XMCA_ASYMMETRIC_CERTIFICATE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCA_END_TIMESTAMP] == 0 ) {

        lex_print_relative_mandatory_message( XMCS_END_TIMESTAMP, XMCA_ASYMMETRIC_CERTIFICATE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMCA_SUBJECT_STR] == 0 ) {

        lex_print_relative_mandatory_message( XMCS_END_TIMESTAMP, XMCA_ASYMMETRIC_CERTIFICATE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XMCA_MAKE_CERTIFICATE_ASYMMETRIC, XAC_BINOMIAL_KEY, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMCA_MAKE_CERTIFICATE_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMCA_MAKE_CERTIFICATE_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_signature_symmetric( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCSS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XCSS_PLAIN_TEXT, XCSS_CHECK_SIGNATURE_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCSS_CHECK_SIGNATURE_SYMMETRIC, XAC_MONOMIAL_KEY, XAC_SYM_SIGNATURE,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCSS_CHECK_SIGNATURE_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCSS_CHECK_SIGNATURE_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_signature_asymmetric( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCSA_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XCSS_PLAIN_TEXT, XCSA_CHECK_SIGNATURE_ASYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCSA_CHECK_SIGNATURE_ASYMMETRIC, XAC_BINOMIAL_KEY, XAC_ASY_SIGNATURE,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCSA_CHECK_SIGNATURE_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCSA_CHECK_SIGNATURE_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_ring_signature( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCRS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XCSS_PLAIN_TEXT, XCRS_CHECK_RING_SIGNATURE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCRS_SIGNER_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XCRS_SIGNER_BINOMIAL_KEY, XCRS_CHECK_RING_SIGNATURE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCRS_CHECK_RING_SIGNATURE, XAC_MONOMIAL_KEY, XAC_RING_SIGNATURE,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCRS_CHECK_RING_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCRS_CHECK_RING_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_certificate_symmetric( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCCS_CHECK_CERTIFICATE_SYMMETRIC, XAC_MONOMIAL_KEY, XAC_SYM_CERTIFICATE,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCCS_CHECK_CERTIFICATE_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCCS_CHECK_CERTIFICATE_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_certificate_asymmetric( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCCA_CHECK_CERTIFICATE_ASYMMETRIC, XAC_BINOMIAL_KEY, XAC_ASY_CERTIFICATE,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCCA_CHECK_CERTIFICATE_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCCA_CHECK_CERTIFICATE_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_hash( int v[], char *all_args[]
 )
{

    if ( v[XMH_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMH_PLAIN_TEXT, XMH_MAKE_HASH, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMH_HASH] == 0 ) {

        lex_print_relative_mandatory_message( XMH_HASH, XMH_MAKE_HASH, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    // skip arithmetic configuration

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XMH_MAKE_HASH, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XMH_MAKE_HASH, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_checksum( int v[], char *all_args[]
 )
{

    if ( v[XMC_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMC_PLAIN_TEXT, XMC_MAKE_CHECKSUM, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMC_CHECKSUM_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMC_CHECKSUM_TEXT, XMC_MAKE_CHECKSUM, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XMC_MAKE_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XMC_MAKE_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XMC_MAKE_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMC_MAKE_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XMC_MAKE_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_checksum( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCC_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XCC_PLAIN_TEXT, XCC_CHECK_CHECKSUM, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCC_CHECKSUM_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XCC_CHECKSUM_TEXT, XCC_CHECK_CHECKSUM, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XCC_CHECK_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XCC_CHECK_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XCC_CHECK_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCC_CHECK_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XCC_CHECK_CHECKSUM, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_hash( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCH_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XCH_PLAIN_TEXT, XCH_CHECK_HASH, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCH_CHECK_HASH, XAC_HASH, XAC_HASH, XAC_HASH, XAC_HASH, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XCH_CHECK_HASH, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCH_CHECK_HASH, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_hash_to_point( int v[], char *all_args[]
 )
{

    if ( v[XCHTP_POINT] == 0 ) {

        lex_print_relative_mandatory_message( XCHTP_POINT, XCHTP_CONVERT_HASH_TO_POINT, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCHTP_CONVERT_HASH_TO_POINT, XAC_HASH, XAC_HASH,
                                    XAC_HASH, XAC_HASH, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCHTP_CONVERT_HASH_TO_POINT, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCHTP_CONVERT_HASH_TO_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_hash_to_monomial_key( int v[], char *all_args[]
 )
{

    if ( v[XCHTMK_MONOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XCHTMK_MONOMIAL_KEY, XCHTMK_CONVERT_HASH_TO_MONOMIAL_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCHTMK_CONVERT_HASH_TO_MONOMIAL_KEY, XAC_HASH, XAC_HASH,
                                    XAC_HASH, XAC_HASH, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCHTMK_CONVERT_HASH_TO_MONOMIAL_KEY, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCHTMK_CONVERT_HASH_TO_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_point_to_monomial_key( int v[], char *all_args[]
 )
{

    if ( v[XCPTMK_MONOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XCPTMK_MONOMIAL_KEY, XCPTMK_CONVERT_POINT_TO_MONOMIAL_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCPTMK_CONVERT_POINT_TO_MONOMIAL_KEY, XAC_POINT, XAC_POINT,
                                    XAC_POINT, XAC_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCPTMK_CONVERT_POINT_TO_MONOMIAL_KEY, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCPTMK_CONVERT_POINT_TO_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_monomial_key_to_point( int v[], char *all_args[]
 )
{

    if ( v[XCMKTP_POINT] == 0 ) {

        lex_print_relative_mandatory_message( XCMKTP_POINT, XCMKTP_CONVERT_MONOMIAL_KEY_TO_POINT, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCMKTP_CONVERT_MONOMIAL_KEY_TO_POINT, XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCMKTP_CONVERT_MONOMIAL_KEY_TO_POINT, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCMKTP_CONVERT_MONOMIAL_KEY_TO_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_binomial_key_to_start_point( int v[], char *all_args[]
 )
{

    if ( v[XCBKTSP_START_POINT] == 0 ) {

        lex_print_relative_mandatory_message( XCBKTSP_START_POINT,
                                              XCBKTSP_CONVERT_BINOMIAL_KEY_TO_START_POINT, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCBKTSP_CONVERT_BINOMIAL_KEY_TO_START_POINT, XAC_BINOMIAL_KEY,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCBKTSP_CONVERT_BINOMIAL_KEY_TO_START_POINT,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCBKTSP_CONVERT_BINOMIAL_KEY_TO_START_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_start_point_to_point( int v[], char *all_args[]
 )
{

    if ( v[XCSPTP_POINT] == 0 ) {

        lex_print_relative_mandatory_message( XCSPTP_POINT, XCSPTP_CONVERT_START_POINT_TO_POINT, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCSPTP_CONVERT_START_POINT_TO_POINT, XAC_START_POINT, XAC_START_POINT,
                                    XAC_START_POINT, XAC_START_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCSPTP_CONVERT_START_POINT_TO_POINT, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCSPTP_CONVERT_START_POINT_TO_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_point_to_start_point( int v[], char *all_args[]
 )
{

    if ( v[XCPTSP_START_POINT] == 0 ) {

        lex_print_relative_mandatory_message( XCPTSP_START_POINT, XCPTSP_CONVERT_POINT_TO_START_POINT,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCPTSP_CONVERT_POINT_TO_START_POINT, XAC_POINT, XAC_POINT,
                                    XAC_POINT, XAC_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCPTSP_CONVERT_POINT_TO_START_POINT, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XCPTSP_CONVERT_POINT_TO_START_POINT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_monomial_key_to_monomial_commitment( int v[], char *all_args[]
 )
{

    if ( v[XCMKTMC_MONOMIAL_COMMITMENT] == 0 ) {

        lex_print_relative_mandatory_message( XCMKTMC_MONOMIAL_COMMITMENT,
                                              XCMKTMC_CONVERT_MONOMIAL_KEY_TO_MONOMIAL_COMMITMENT, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCMKTMC_CONVERT_MONOMIAL_KEY_TO_MONOMIAL_COMMITMENT, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCMKTMC_CONVERT_MONOMIAL_KEY_TO_MONOMIAL_COMMITMENT,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCMKTMC_CONVERT_MONOMIAL_KEY_TO_MONOMIAL_COMMITMENT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_monomial_commitment_to_monomial_key( int v[], char *all_args[]
 )
{

    if ( v[XCMCTMK_MONOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XCMCTMK_MONOMIAL_KEY,
                                              XCMCTMK_CONVERT_MONOMIAL_COMMITMENT_TO_MONOMIAL_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCMCTMK_CONVERT_MONOMIAL_COMMITMENT_TO_MONOMIAL_KEY,
                                    XAC_MONOMIAL_COMMITMENT, XAC_MONOMIAL_COMMITMENT, XAC_MONOMIAL_COMMITMENT,
                                    XAC_MONOMIAL_COMMITMENT, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCMCTMK_CONVERT_MONOMIAL_COMMITMENT_TO_MONOMIAL_KEY,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCMCTMK_CONVERT_MONOMIAL_COMMITMENT_TO_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_symmetric_certificate_to_monovalent_key( int v[], char *all_args[]
 )
{

    if ( v[XCSCTMK_MONOVALENT_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XCSCTMK_MONOVALENT_KEY,
                                              XCSCTMK_CONVERT_SYMMETRIC_CERTIFICATE_TO_MONOVALENT_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCSCTMK_CONVERT_SYMMETRIC_CERTIFICATE_TO_MONOVALENT_KEY,
                                    XAC_SYM_CERTIFICATE, XAC_SYM_CERTIFICATE, XAC_SYM_CERTIFICATE,
                                    XAC_SYM_CERTIFICATE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF,
                                    XCSCTMK_CONVERT_SYMMETRIC_CERTIFICATE_TO_MONOVALENT_KEY, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCSCTMK_CONVERT_SYMMETRIC_CERTIFICATE_TO_MONOVALENT_KEY, v,
                                     all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_asymmetric_certificate_to_binomial_key( int v[], char *all_args[]
 )
{

    if ( v[XCACTBK_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XCACTBK_BINOMIAL_KEY,
                                              XCACTBK_CONVERT_ASYMMETRIC_CERTIFICATE_TO_BINOMIAL_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCACTBK_CONVERT_ASYMMETRIC_CERTIFICATE_TO_BINOMIAL_KEY,
                                    XAC_ASY_CERTIFICATE, XAC_ASY_CERTIFICATE, XAC_ASY_CERTIFICATE,
                                    XAC_ASY_CERTIFICATE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCACTBK_CONVERT_ASYMMETRIC_CERTIFICATE_TO_BINOMIAL_KEY,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCACTBK_CONVERT_ASYMMETRIC_CERTIFICATE_TO_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_asymmetric_signature_to_binomial_key( int v[], char *all_args[]
 )
{

    if ( v[XCASTBK_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XCASTBK_BINOMIAL_KEY,
                                              XCASTBK_CONVERT_ASYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCASTBK_CONVERT_ASYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY,
                                    XAC_ASY_SIGNATURE, XAC_ASY_SIGNATURE, XAC_ASY_SIGNATURE,
                                    XAC_ASY_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCASTBK_CONVERT_ASYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCASTBK_CONVERT_ASYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_symmetric_signature_to_binomial_key( int v[], char *all_args[]
 )
{

    if ( v[XCSSTBK_BINOMIAL_KEY] == 0 ) {

        lex_print_relative_mandatory_message( XCSSTBK_BINOMIAL_KEY,
                                              XCSSTBK_CONVERT_SYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCSSTBK_CONVERT_SYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY,
                                    XAC_SYM_SIGNATURE, XAC_ASY_SIGNATURE, XAC_ASY_SIGNATURE,
                                    XAC_ASY_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCSSTBK_CONVERT_SYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCSSTBK_CONVERT_SYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_binomial_key_to_asymmetric_signature( int v[], char *all_args[]
 )
{

    if ( v[XCBKTAS_ASYMMETRIC_SIGNATURE] == 0 ) {

        lex_print_relative_mandatory_message( XCBKTAS_ASYMMETRIC_SIGNATURE,
                                              XCBKTAS_CONVERT_BINOMIAL_KEY_TO_ASYMMETRIC_SIGNATURE,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCBKTAS_CONVERT_BINOMIAL_KEY_TO_ASYMMETRIC_SIGNATURE,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY,
                                    XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCBKTAS_CONVERT_BINOMIAL_KEY_TO_ASYMMETRIC_SIGNATURE,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCBKTAS_CONVERT_BINOMIAL_KEY_TO_ASYMMETRIC_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_convert_binomial_key_to_symmetric_signature( int v[], char *all_args[]
 )
{

    if ( v[XCBKTSS_SYMMETRIC_SIGNATURE] == 0 ) {

        lex_print_relative_mandatory_message( XCBKTSS_SYMMETRIC_SIGNATURE,
                                              XCBKTSS_CONVERT_BINOMIAL_KEY_TO_SYMMETRIC_SIGNATURE, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XCBKTSS_CONVERT_BINOMIAL_KEY_TO_SYMMETRIC_SIGNATURE,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY,
                                    XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCBKTSS_CONVERT_BINOMIAL_KEY_TO_SYMMETRIC_SIGNATURE,
                                    all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_permutation_conf( XCBKTSS_CONVERT_BINOMIAL_KEY_TO_SYMMETRIC_SIGNATURE, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_split_symmetric( int v[], char *all_args[]
 )
{

    if ( v[XSS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XSS_PLAIN_TEXT, XSS_SPLIT_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XSS_CHALLENGE_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XSS_CHALLENGE_TEXT, XSS_SPLIT_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XSS_SOLUTION_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XSS_SOLUTION_TEXT, XSS_SPLIT_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XSS_SPLIT_SYMMETRIC, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XSS_SPLIT_SYMMETRIC, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XSS_SPLIT_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_join_symmetric( int v[], char *all_args[]
 )
{

    if ( v[XJS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XJS_PLAIN_TEXT, XJS_JOIN_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XJS_CHALLENGE_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XJS_CHALLENGE_TEXT, XJS_JOIN_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XJS_SOLUTION_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XJS_SOLUTION_TEXT, XJS_JOIN_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XJS_JOIN_SYMMETRIC, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XJS_JOIN_SYMMETRIC, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XJS_JOIN_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_encrypt_symmetric( int v[], char *all_args[]
 )
{

    if ( v[XES_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XES_PLAIN_TEXT, XES_ENCRYPT_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XES_CIPHER_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XES_CIPHER_TEXT, XES_ENCRYPT_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XES_ENCRYPT_SYMMETRIC, XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XES_ENCRYPT_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XES_ENCRYPT_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_encrypt_asymmetric( int v[], char *all_args[]
 )
{

    if ( v[XEA_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XEA_PLAIN_TEXT, XEA_ENCRYPT_ASYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XEA_CIPHER_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XEA_CIPHER_TEXT, XEA_ENCRYPT_ASYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XEA_ENCRYPT_ASYMMETRIC, XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY,
                                    XAC_BINOMIAL_KEY, XAC_BINOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XEA_ENCRYPT_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XEA_ENCRYPT_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_decipher_asymmetric( int v[], char *all_args[]
 )
{

    if ( v[XDA_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XDA_PLAIN_TEXT, XDA_DECIPHER_ASYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XDA_CIPHER_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XDA_CIPHER_TEXT, XDA_DECIPHER_ASYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XDA_DECIPHER_ASYMMETRIC, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XDA_DECIPHER_ASYMMETRIC, XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XDA_DECIPHER_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XDA_DECIPHER_ASYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_decipher_symmetric( int v[], char *all_args[]
 )
{

    if ( v[XDS_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XDS_PLAIN_TEXT, XDS_DECIPHER_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XDS_CIPHER_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XDS_CIPHER_TEXT, XDS_DECIPHER_SYMMETRIC, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XDS_DECIPHER_SYMMETRIC, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS !=
         lex_check_arithmetic_conf( XDS_DECIPHER_SYMMETRIC, XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY,
                                    XAC_MONOMIAL_KEY, XAC_MONOMIAL_KEY, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_sequence_conf( XDS_DECIPHER_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_permutation_conf( XDS_DECIPHER_SYMMETRIC, v, all_args ) ) {
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_check_complete_blocks( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XCCB_BLOCK_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XCCB_BLOCK_FILE, XCCB_CHECK_COMPLETE_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XCCB_CHECK_COMPLETE_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XCCB_CHECK_COMPLETE_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XCCB_CHECK_COMPLETE_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XSS_SPLIT_SYMMETRIC, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XSS_SPLIT_SYMMETRIC, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_block( int v[], char *all_args[]
 )
{

    if ( v[XMB_OFFSET] == 0 ) {

        lex_print_relative_mandatory_message( XMB_OFFSET, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMB_LENGTH] == 0 ) {

        lex_print_relative_mandatory_message( XMB_LENGTH, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMB_TAG] == 0 ) {

        lex_print_relative_mandatory_message( XMB_TAG, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMB_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XMB_PLAIN_TEXT, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMB_BLOCK_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XMB_BLOCK_FILE, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XMB_MAKE_BLOCK, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_merge_block( int v[], char *all_args[]
 )
{

    // defined in XRN_MAX_MERGE_PARALLELISM in xrn_common.md
    if ( ( v[XCB_BLOCK_FILE] >= 64 ) || ( v[XCB_BLOCK_FILE] < 2 ) ) {

        snprintf
            ( lexer_log.buffer, BUFF_PRINT_SIZE,
              "\nlexer error: the number of %s options needs to be between 63 and 2, number of blocks detected %d\n",
              all_args[XCB_BLOCK_FILE], v[XCB_BLOCK_FILE] );
        XLEX_PRINT(  );
        return XRNL_ERROR;

    }

    if ( v[XCB_COMBINED_BLOCK_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XMB_TAG, XCB_COMBINE_BLOCKS, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XCB_COMBINE_BLOCKS, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XCB_COMBINE_BLOCKS, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XCB_COMBINE_BLOCKS, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XCB_COMBINE_BLOCKS, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XCB_COMBINE_BLOCKS, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_strip_header_from_block( int v[], char *all_args[]
 )
{

    if ( v[XSHFB_BLOCK_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XSHFB_BLOCK_FILE, XSHFB_STRIP_HEADER_FROM_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XSHFB_PLAIN_TEXT] == 0 ) {

        lex_print_relative_mandatory_message( XSHFB_PLAIN_TEXT, XSHFB_STRIP_HEADER_FROM_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XSHFB_STRIP_HEADER_FROM_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XSHFB_STRIP_HEADER_FROM_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XSHFB_STRIP_HEADER_FROM_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XSHFB_STRIP_HEADER_FROM_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XSHFB_STRIP_HEADER_FROM_BLOCK, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_print_header( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XPH_XRN_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XPH_XRN_FILE, XPH_PRINT_HEADER, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XPH_PRINT_HEADER, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XPH_PRINT_HEADER, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XPH_PRINT_HEADER, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] == 0 ) {
        lex_print_relative_mandatory_message( XPC_PERMUTATION_CONF, XPH_PRINT_HEADER, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_print_lib_info( int v[], char *all_args[]
 )
{

    if ( v[XLC_LIB_INFO_LOG] == 0 ) {

        lex_print_relative_mandatory_message( XLC_LIB_INFO_LOG, XCXC_CHECK_XMATRIX_COMP, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XPLI_PRINT_LIB_INFO, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XPLI_PRINT_LIB_INFO, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XPLI_PRINT_LIB_INFO, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XPLI_PRINT_LIB_INFO, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XPLI_PRINT_LIB_INFO, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_get_capacity( int v[], char *all_args[]
 )
{

    if ( v[XGC_ENVELOP_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XGC_ENVELOP_FILE, XGC_GET_CAPACITY, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XGC_GET_CAPACITY, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XGC_GET_CAPACITY, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XGC_GET_CAPACITY, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XGC_GET_CAPACITY, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XGC_GET_CAPACITY, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_extract_steganography_raw( int v[], char *all_args[]
 )
{

    if ( v[XESR_EMBEDDED_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XESR_EMBEDDED_FILE, XESR_EXTRACT_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;

    }

    if ( v[XESR_RAW_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XESR_RAW_FILE, XESR_EXTRACT_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XESR_EXTRACT_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XESR_EXTRACT_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XESR_EXTRACT_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XESR_EXTRACT_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XESR_EXTRACT_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_extract_steganography_block( int v[], char *all_args[]
 )
{

    if ( v[XESB_EMBEDDED_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XESB_EMBEDDED_FILE, XESB_EXTRACT_STEGANOGRAPHY_BLOCK,
                                              all_args );
        return XRNL_ERROR;

    }

    if ( v[XESB_BLOCK_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XESB_BLOCK_FILE, XESB_EXTRACT_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( XRNL_SUCCESS != lex_check_decoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XESB_EXTRACT_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XESB_EXTRACT_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XESB_EXTRACT_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XESB_EXTRACT_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_steganography_raw( int v[], char *all_args[]
 )
{

    if ( v[XMSR_EMBEDDED_FILE] == 0 ) {
        lex_print_relative_mandatory_message( XMSR_EMBEDDED_FILE, XMSR_MAKE_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSR_ENVELOP_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XMSR_ENVELOP_FILE, XMSR_MAKE_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSR_SOURCE_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XMSR_SOURCE_FILE, XMSR_MAKE_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XMSR_MAKE_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    if ( v[XEC_ENCODING_CONF] ) {
        lex_print_redundant_option( XEC_ENCODING_CONF, XMSR_MAKE_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XMSR_MAKE_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMSR_MAKE_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XMSR_MAKE_STEGANOGRAPHY_RAW, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lex_check_make_steganography_block( int v[], char *all_args[]
 )
{

    if ( v[XMSB_TAG] == 0 ) {

        lex_print_relative_mandatory_message( XMSB_TAG, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSB_LENGTH] == 0 ) {

        lex_print_relative_mandatory_message( XMSB_LENGTH, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSB_OFFSET] == 0 ) {

        lex_print_relative_mandatory_message( XMSB_OFFSET, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSB_EMBEDDED_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XMSB_EMBEDDED_FILE, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSB_ENVELOP_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XMSB_ENVELOP_FILE, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XMSB_SOURCE_FILE] == 0 ) {

        lex_print_relative_mandatory_message( XMSB_SOURCE_FILE, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;

    }

    if ( v[XLC_LOGGING_CONF] ) {

        if ( XRNL_SUCCESS != lex_check_logging_conf( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    if ( v[XDC_DECODING_CONF] ) {
        lex_print_redundant_option( XDC_DECODING_CONF, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( XRNL_SUCCESS != lex_check_encoding_conf( v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( v[XAC_ARITHMETIC_CONF] ) {
        lex_print_redundant_option( XAC_ARITHMETIC_CONF, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XSC_SEQUENCE_CONF] ) {
        lex_print_redundant_option( XSC_SEQUENCE_CONF, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;
    }

    if ( v[XPC_PERMUTATION_CONF] ) {
        lex_print_redundant_option( XPC_PERMUTATION_CONF, XMSB_MAKE_STEGANOGRAPHY_BLOCK, all_args );
        return XRNL_ERROR;
    }

    return XRNL_SUCCESS;

}

int lexcheck_all( int v[], char *all_args[]
 )
{

    int command;

    if ( XRNL_SUCCESS != lex_check_multiple_cummands( v, all_args, &command ) ) {
        return XRNL_ERROR_NO_CMD;
    }

    if ( XRNL_SUCCESS != lex_check_option_multiple_cummands( command, v, all_args ) ) {
        return XRNL_ERROR;
    }

    if ( command == XDC_DECODING_CONF ) {
    } else if ( command == XEC_ENCODING_CONF ) {
    } else if ( command == XAC_ARITHMETIC_CONF ) {
    } else if ( command == XSC_SEQUENCE_CONF ) {
    } else if ( command == XPC_PERMUTATION_CONF ) {
    } else if ( command == XLC_LOGGING_CONF ) {
    } else if ( command == XDEP_DUMP_ENCODING_PARAM ) {
        if ( XRNL_SUCCESS != lex_check_dump_encoding_param( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XDE_DECODE_ENCODE ) {
        if ( XRNL_SUCCESS != lex_check_decode_encode( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMXCR_MINE_XMATRIX_COMP_RND ) {
        if ( XRNL_SUCCESS != lex_check_mine_xmatrix_comp_rand( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMXCO_MINE_XMATRIX_COMP_OT ) {
        if ( XRNL_SUCCESS != lex_check_mine_xmatrix_comp_ot( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XPXCR_PERMUTE_XMATRIX_COMP_RANDOM ) {
        if ( XRNL_SUCCESS != lex_check_permute_xmatrix_comp_random( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XPXCD_PERMUTE_XMATRIX_COMP_DETERMINISTIC ) {
        if ( XRNL_SUCCESS != lex_check_permute_xmatrix_comp_deterministic( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XPXCS_PERMUTE_XMATRIX_COMP_CONFIDENTIAL ) {
        if ( XRNL_SUCCESS != lex_check_permute_xmatrix_comp_confidential( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XDX_DECOMPRESS_XMATRIX ) {
        if ( XRNL_SUCCESS != lex_check_decompress_xmatrix( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCXC_CHECK_XMATRIX_COMP ) {
        if ( XRNL_SUCCESS != lex_check_check_xmatrix_comp( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCX_CHECK_XMATRIX ) {
        if ( XRNL_SUCCESS != lex_check_check_xmatrix( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMP_MAKE_POINT ) {
        if ( XRNL_SUCCESS != lex_check_make_point( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMSPRN_MAKE_CONFIDENTIAL_PSEUDO_RANDOM_NUMBER ) {
        if ( XRNL_SUCCESS != lex_check_make_confidential_pseudo_random_number( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMSP_MAKE_START_POINT ) {
        if ( XRNL_SUCCESS != lex_check_make_start_point( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMMK_MAKE_MONOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_make_monomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMBK_MAKE_BINOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_make_binomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XEMK_EXCHANGE_MONOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_exchange_monomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMMK_MAKE_MONOVALENT_KEY ) {
        if ( XRNL_SUCCESS != lex_check_make_monovalent_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XEPK_EXCHANGE_POLYVALENT_KEY ) {
        if ( XRNL_SUCCESS != lex_check_exchange_polyvalent_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCMK_CHECK_MONOVALENT_KEY ) {
        if ( XRNL_SUCCESS != lex_check_check_monovalent_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMCBK_MAKE_COMMITMENT_BINOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_make_commitment_binomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMCSS_MAKE_COMMITMENT_SYM_SIGNATURE ) {
        if ( XRNL_SUCCESS != lex_check_make_commitment_sym_signature( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMCSC_MAKE_COMMITMENT_SYM_CERTIFICATE ) {
        if ( XRNL_SUCCESS != lex_check_make_commitment_sym_certificate( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMR_MAKE_RESPONSE ) {
        if ( XRNL_SUCCESS != lex_check_make_response( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMMP_MAKE_MONOMIAL_PROOF ) {
        if ( XRNL_SUCCESS != lex_check_make_monomial_proof( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMMPSS_MAKE_MONOMIAL_PROOF_SYM_SIGNATURE ) {
        if ( XRNL_SUCCESS != lex_check_make_monomial_proof_sym_signature( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMMPSC_MAKE_MONOMIAL_PROOF_SYM_CERTIFICATE ) {
        if ( XRNL_SUCCESS != lex_check_make_monomial_proof_sym_certificate( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCMP_CHECK_MONOMIAL_PROOF ) {
        if ( XRNL_SUCCESS != lex_check_check_monomial_proof( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCMPSS_CHECK_MONOMIAL_PROOF_SYM_SIGNATURE ) {
        if ( XRNL_SUCCESS != lex_check_check_monomial_proof_sym_signature( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCMPSC_CHECK_MONOMIAL_PROOF_SYM_CERTIFICATE ) {
        if ( XRNL_SUCCESS != lex_check_check_monomial_proof_sym_certificate( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMSS_MAKE_SIGNATURE_SYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_make_signature_symmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMSA_MAKE_SIGNATURE_ASYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_make_signature_asymmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMRS_MAKE_RING_SIGNATURE ) {
        if ( XRNL_SUCCESS != lex_check_make_ring_signature( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XPRS_PERMUTE_RING_SIGNATURE ) {
        if ( XRNL_SUCCESS != lex_check_permute_ring_signature( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMCS_MAKE_CERTIFICATE_SYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_make_certificate_symmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMCA_MAKE_CERTIFICATE_ASYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_make_certificate_asymmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCSS_CHECK_SIGNATURE_SYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_check_signature_symmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCSA_CHECK_SIGNATURE_ASYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_check_signature_asymmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCRS_CHECK_RING_SIGNATURE ) {
        if ( XRNL_SUCCESS != lex_check_check_ring_signature( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCCS_CHECK_CERTIFICATE_SYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_check_certificate_symmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCCA_CHECK_CERTIFICATE_ASYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_check_certificate_asymmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMH_MAKE_HASH ) {
        if ( XRNL_SUCCESS != lex_check_make_hash( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMC_MAKE_CHECKSUM ) {
        if ( XRNL_SUCCESS != lex_check_make_checksum( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCC_CHECK_CHECKSUM ) {
        if ( XRNL_SUCCESS != lex_check_check_checksum( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCH_CHECK_HASH ) {
        if ( XRNL_SUCCESS != lex_check_check_hash( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCHTMK_CONVERT_HASH_TO_MONOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_convert_hash_to_monomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCHTP_CONVERT_HASH_TO_POINT ) {
        if ( XRNL_SUCCESS != lex_check_convert_hash_to_point( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCPTMK_CONVERT_POINT_TO_MONOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_convert_point_to_monomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCMKTP_CONVERT_MONOMIAL_KEY_TO_POINT ) {
        if ( XRNL_SUCCESS != lex_check_convert_monomial_key_to_point( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCBKTSP_CONVERT_BINOMIAL_KEY_TO_START_POINT ) {
        if ( XRNL_SUCCESS != lex_check_convert_binomial_key_to_start_point( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCSPTP_CONVERT_START_POINT_TO_POINT ) {
        if ( XRNL_SUCCESS != lex_check_convert_start_point_to_point( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCPTSP_CONVERT_POINT_TO_START_POINT ) {
        if ( XRNL_SUCCESS != lex_check_convert_point_to_start_point( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCMKTMC_CONVERT_MONOMIAL_KEY_TO_MONOMIAL_COMMITMENT ) {
        if ( XRNL_SUCCESS != lex_check_convert_monomial_key_to_monomial_commitment( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCMCTMK_CONVERT_MONOMIAL_COMMITMENT_TO_MONOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_convert_monomial_commitment_to_monomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCSCTMK_CONVERT_SYMMETRIC_CERTIFICATE_TO_MONOVALENT_KEY ) {
        if ( XRNL_SUCCESS != lex_check_convert_symmetric_certificate_to_monovalent_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCACTBK_CONVERT_ASYMMETRIC_CERTIFICATE_TO_BINOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_convert_asymmetric_certificate_to_binomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCASTBK_CONVERT_ASYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_convert_asymmetric_signature_to_binomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCSSTBK_CONVERT_SYMMETRIC_SIGNATURE_TO_BINOMIAL_KEY ) {
        if ( XRNL_SUCCESS != lex_check_convert_symmetric_signature_to_binomial_key( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCBKTAS_CONVERT_BINOMIAL_KEY_TO_ASYMMETRIC_SIGNATURE ) {
        if ( XRNL_SUCCESS != lex_check_convert_binomial_key_to_asymmetric_signature( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCBKTSS_CONVERT_BINOMIAL_KEY_TO_SYMMETRIC_SIGNATURE ) {
        if ( XRNL_SUCCESS != lex_check_convert_binomial_key_to_symmetric_signature( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XSS_SPLIT_SYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_split_symmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XEA_ENCRYPT_ASYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_encrypt_asymmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XES_ENCRYPT_SYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_encrypt_symmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XJS_JOIN_SYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_join_symmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XDA_DECIPHER_ASYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_decipher_asymmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XDS_DECIPHER_SYMMETRIC ) {
        if ( XRNL_SUCCESS != lex_check_decipher_symmetric( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCCB_CHECK_COMPLETE_BLOCK ) {
        if ( XRNL_SUCCESS != lex_check_check_complete_blocks( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMB_MAKE_BLOCK ) {
        if ( XRNL_SUCCESS != lex_check_make_block( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XCB_COMBINE_BLOCKS ) {
        if ( XRNL_SUCCESS != lex_check_merge_block( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XSHFB_STRIP_HEADER_FROM_BLOCK ) {
        if ( XRNL_SUCCESS != lex_check_strip_header_from_block( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XPH_PRINT_HEADER ) {
        if ( XRNL_SUCCESS != lex_check_print_header( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XPLI_PRINT_LIB_INFO ) {
        if ( XRNL_SUCCESS != lex_check_print_lib_info( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XGC_GET_CAPACITY ) {
        if ( XRNL_SUCCESS != lex_check_get_capacity( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMSB_MAKE_STEGANOGRAPHY_BLOCK ) {
        if ( XRNL_SUCCESS != lex_check_make_steganography_block( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XESB_EXTRACT_STEGANOGRAPHY_BLOCK ) {
        if ( XRNL_SUCCESS != lex_check_extract_steganography_block( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XMSR_MAKE_STEGANOGRAPHY_RAW ) {
        if ( XRNL_SUCCESS != lex_check_make_steganography_raw( v, all_args ) ) {
            return XRNL_ERROR;
        }

    } else if ( command == XESR_EXTRACT_STEGANOGRAPHY_RAW ) {
        if ( XRNL_SUCCESS != lex_check_extract_steganography_raw( v, all_args ) ) {
            return XRNL_ERROR;
        }

    }

    return XRNL_SUCCESS;

}

